'''
Author: Maxuxu
Date: 2022-01-15 15:41:31
LastEditors: Maxuxu
LastEditTime: 2022-03-12 17:14:23
FilePath: \Python\os文件处理\file-deleteTargetFile.py
Description: 

Copyright (c) 2022 by maxuxu/taiji, All Rights Reserved. 
'''
'''
Author: Maxuxu
Date: 2022-01-15 15:41:31
LastEditors: Maxuxu
LastEditTime: 2022-03-12 17:13:40
FilePath: \Python\os文件处理\file-deleteTargetFile.py
Description: 

Copyright (c) 2022 by maxuxu/taiji, All Rights Reserved. 
'''
import os
from asyncio.windows_events import NULL
import shutil
import cv2

list = os.listdir('./')
i =0
if __name__ == '__main__':
    for list_sam in list:
        try:
            test = os.listdir(f'./{list_sam}')
            for te in test:
                mp4 = te.endswith('mp4==========')
                avi = te.endswith('avi==========')
                # print(ls)
                if mp4:
                    i = i + 1
                    print(f"删除第{i}个：{te}")
                    shutil.rmtree(f'./{list_sam}')
                elif avi:
                    i = i + 1
                    print(f"删除第{i}个：{te}")
                    shutil.rmtree(f'./{list_sam}')
                    i = i + 1
        except:
            print(f"{list_sam}不是文件夹")

    print("一共删除了{}个文件".format(i))
